Telegram Group & Telegram Channel
Что выведет этот код при запуске на Python 3.10+ (например, 3.11)?


📌 Подсказка: Подумайте о порядке проверок, о том, какие атрибуты попадают в others, и об использовании __match_args__.

Ответ:

Automatic mode
Mode manual, other keys: ['threshold', 'debug']
Low threshold 0
Краткое пояснение:

Для первого объекта (mode="auto", threshold=10) срабатывает первый case Config(mode="auto") → Automatic mode.

Для второго (mode="manual", threshold=5, debug=True) первый не совпадает, второй с threshold<5 не проходит (5 < 5 → False), зато третий case Config(mode=mode, **others) — биндинг mode='manual', остальные ключи (threshold и debug) попадают в others → Mode manual, other keys: ['threshold', 'debug'].

Для третьего (threshold=0) первый и третий не подходят (нет mode), а второй — case Config(threshold=threshold) if threshold<5 — срабатывает (0<5) → Low threshold 0.


@pythonl



tg-me.com/pythonl/4785
Create:
Last Update:

Что выведет этот код при запуске на Python 3.10+ (например, 3.11)?


📌 Подсказка: Подумайте о порядке проверок, о том, какие атрибуты попадают в others, и об использовании __match_args__.

Ответ:

Automatic mode
Mode manual, other keys: ['threshold', 'debug']
Low threshold 0
Краткое пояснение:

Для первого объекта (mode="auto", threshold=10) срабатывает первый case Config(mode="auto") → Automatic mode.

Для второго (mode="manual", threshold=5, debug=True) первый не совпадает, второй с threshold<5 не проходит (5 < 5 → False), зато третий case Config(mode=mode, **others) — биндинг mode='manual', остальные ключи (threshold и debug) попадают в others → Mode manual, other keys: ['threshold', 'debug'].

Для третьего (threshold=0) первый и третий не подходят (нет mode), а второй — case Config(threshold=threshold) if threshold<5 — срабатывает (0<5) → Low threshold 0.


@pythonl

BY Python/ django




Share with your friend now:
tg-me.com/pythonl/4785

View MORE
Open in Telegram


Python django Telegram | DID YOU KNOW?

Date: |

How Does Bitcoin Work?

Bitcoin is built on a distributed digital record called a blockchain. As the name implies, blockchain is a linked body of data, made up of units called blocks that contain information about each and every transaction, including date and time, total value, buyer and seller, and a unique identifying code for each exchange. Entries are strung together in chronological order, creating a digital chain of blocks. “Once a block is added to the blockchain, it becomes accessible to anyone who wishes to view it, acting as a public ledger of cryptocurrency transactions,” says Stacey Harris, consultant for Pelicoin, a network of cryptocurrency ATMs. Blockchain is decentralized, which means it’s not controlled by any one organization. “It’s like a Google Doc that anyone can work on,” says Buchi Okoro, CEO and co-founder of African cryptocurrency exchange Quidax. “Nobody owns it, but anyone who has a link can contribute to it. And as different people update it, your copy also gets updated.”

At a time when the Indian stock market is peaking and has rallied immensely compared to global markets, there are companies that have not performed in the last 10 years. These are definitely a minor portion of the market considering there are hundreds of stocks that have turned multibagger since 2020. What went wrong with these stocks? Reasons vary from corporate governance, sectoral weakness, company specific and so on. But the more important question is, are these stocks worth buying?

Python django from tw


Telegram Python/ django
FROM USA